﻿

// ************************************************************
// IMPORTS.
// ************************************************************

import as.frameMan;
import as.tweenMan;

// ************************************************************
// GLOBAL ELEMENTS
// ************************************************************

// var easeIn = mx.transitions.easing.Strong.easeIn;
// var easeInOut = mx.transitions.easing.Regular.easeInOut;
// var easeElastic = mx.transitions.easing.Elastic.easeOut;
// var easeBack = mx.transitions.easing.Back.easeOut;
// var easeReg = mx.transitions.easing.Regular.easeOut;
// var easeIn = mx.transitions.easing.Strong.easeIn;
var easeNone = mx.transitions.easing.None.easeNone;

var fMan = new frameMan([0,3000,1000,6000,4000,5000]);
var tMan = tweenMan.getInstance();


// ************************************************************
// GLOBAL FUNCTIONS
// ************************************************************

bg_mc.onRelease = function(){ // EYEBLASTER CLICKTAG FUNCTION.
	EB.Clickthrough();
}

function doShake() {
	fMan.stop();
	fMan.resume(4);
	//screen_mc.dropSomeMore();
	
}

// initialize.
fMan.frame[0] = function(){
	legal_mc._alpha = 0;
	txt1_mc._alpha = 0;
	txt2_mc._alpha = 0;
	drink_mc._alpha = 0;
	new_mc._alpha = 0;
	title_mc._alpha = 0;
	cta_mc._alpha = 0;
	
	bg_mc._visible = false;
	
	shaker_mc.shakeCallBack = doShake;
}

fMan.frame[1] = function(){
	screen_mc.startDrop();
	//shaker_mc.forceShake();
	tween_fn( shaker_mc, "_xm", .2, .2, null, null, .5 );
}
fMan.frame[2] = function() {
	//shaker_mc.forceShake();
	tween_fn( shaker_mc, "_xm", .2, .2 );
}
fMan.frame[3] = function() {
	//shaker_mc.forceShake();
	tween_fn( shaker_mc, "_xm", -.2, .2 );
}
fMan.frame[4] = function() {
	screen_mc.dropInAll();
	
	bg_mc._visible = true;
	bg_mc._alpha = 0;
	//tween_fn( bg_mc, "_y", 0, 1, easeNone, null, 2 );
	tween_fn( bg_mc, "_alpha", 100, 1, null, null, 2.5 );
	tween_fn( legal_mc, "_alpha", 100, 1, null, null, 2.5 );
	tween_fn( txt1_mc, "_alpha", 100, 1, null, null, 2.5 );
	tween_fn( drink_mc, "_alpha", 100, 1, null, null, 2.5 );
}
fMan.frame[5] = function() {
	screen_mc.dropOut();
}
fMan.frame[6] = function() {
	tween_fn( txt1_mc, "_alpha", 0, 1 );
	tween_fn( new_mc, "_alpha", 100, 1, null, null, .2 );
	tween_fn( title_mc, "_alpha", 100, 1, null, null, .4 );
	tween_fn( txt2_mc, "_alpha", 100, 1, null, null, .6 );
	tween_fn( cta_mc, "_alpha", 100, 1, null, null, .8 );
	
	cta_mc.onRelease = bg_mc.onRelease;
	cta_mc.onRollOver = function() {
		tween_fn( cta_mc, ["_xscale", "_yscale"], [105, 105], .3 );
	}
	cta_mc.onRollOut = function() {
		tween_fn( cta_mc, ["_xscale", "_yscale"], [100, 100], .3 );
	}
}

// ************************************************************
// INITIALIZE.
// ************************************************************
fMan.start();
stop();